* This do file replicates Nunn (2010) adding our controls to his specification

* Set file directory path using <cd>


* Merge with Afrobarometer to retrieve longitude and latitude of place of residence & gridcell
use "Appendix Table A12\afrobarometer5_geo_25km.dta", replace // This data set includes link the respno to the gridcells that are within 25 km distance to respondent


* Drop North African countries
* gen isocode=substr(respno, 1,3)
drop if isocode=="MAU" | isocode=="CVE"

egen min_dist = min(dist2grid), by(respno)
gen incell=(dist2grid==min_dist)
drop min_dist
keep if incell==1 // Note: there may be more than one grid per respno, if respno is located between 2 (or 4) grid cells.

** Merge with Africa grid
merge m:m gridcell using "Appendix Table A12\grid_africa.dta", nogenerate keep(match)
label var alt_mean "Mean altitude of grid in which Afrobarometer cluster is located"

tempfile fulldata
save `fulldata', replace


************************************************************************************************
* Generate and merge with village data

* This do file compiles the variables at village level
** aggregating data that is measured at a radius of 25 km of the village centroid

tempfile villagedata5

use "Appendix Table A12\afrobarometer5_geo_25km.dta", replace
// Afro_round3_geo contains for each respno the 19 gridcells that are within 25 km distance of the place of residence of the respondent: 19= 3+4+5+4+3 around the cell

merge m:1 gridcell using "Appendix Table A12\rail_africa_yrbuilt", nogenerate keep(match)

egen min_dist = min(dist2grid), by(respno)
gen incell=(dist2grid==min_dist)

merge m:m gridcell using "Appendix Table A12\grid_africa.dta", nogenerate keep(match)

* Nunn: explorer_contact // prior to 1895
* Nunn: railway_contact // as of 1897

gen explorer_contact=(dist2explorer<=12)
gen railway_contact=(dist2rail1900<=12)
gen railway_contact_dissect=(railway_contact==1 & incell==1)
gen railway_contact_dissect97=(railway_contact==1 & incell==1 & rail_year_built!=0 & rail_year_built<=1897)

collapse (sum) loc_missionnunn=n_missionnunn ///
loc_beach03_pro_yn_0=beach03_pro_yn_0 loc_beach03_pro_yn_15=beach03_pro_yn_15 loc_beach03_pro_yn_20=beach03_pro_yn_20 loc_beach03_pro_yn_50=beach03_pro_yn_50 loc_beach03_pro_yn_100=beach03_pro_yn_100 ///
loc_density1800m_25=density1800m loc_citypop1900_25=citypop1900_10 ///
loc_urbc1900_25=urbc1900 loc_rurc1900_25=rurc1900 ///
(sum) loc_ncity1400_25=city1400 loc_ncity1800_25=city1800 ///
locn_slaveports_25km=dist2slaveport_10km ///
loc_cells_river=dist2river_nav10 ///
(max) loc_ncity1400_25dum=city1400 loc_ncity1800_25dum=city1800 loc_explorer_contact=explorer_contact loc_railway_contact_dissect97=railway_contact_dissect97 /// 
loc_density1800m_max=density1800m loc_citypop1900_25_max=citypop1900_10 loc_urbc1900_25_max=urbc1900 loc_rurc1900_25_max=rurc1900 /// 
(sd) loc_density1800m_sd25=density1800m ///
, by(respno)

* Variables recoded from grid cells within 25 km
replace loc_citypop1900_25= (loc_citypop1900_25+1)
gen loc_lcitypop1900_25=ln(loc_citypop1900_25)
replace  loc_urbc1900_25=loc_urbc1900_25+1
gen loc_lurbc1900_25=ln(loc_urbc1900_25)
gen loc_lrurc1900_25=ln(loc_rurc1900_25)

keep respno loc*

save `villagedata5', replace

use `fulldata', replace
merge m:1 respno using `villagedata5', nogenerate keep(match)

************************************************************************************************
** Merge with Afrobarometer 5 data **
merge m:1 respno using "Appendix Table A12\Merged R5.fulldata.dta", force nogenerate keep(match)

* Question Number: Q84
* Question: Let us get back to talking about you. What is your ethnic community, cultural group or tribe?
* Variable Label: Tribe or ethnic group

label define ethnic 1"Adja" 2"Afrikaaner" 3"Akan" 4"Arabe" 5"Bobo" 6"Chewa" 7"Coloured" 8"Dafing" 9"English" 10"Fon" 11"Haoussa" 12"Hausa" 13"Kissi" 14"Konkomba" 15"Koro" 16"Kru" 17"Lomwe" 18"Lozi" 19"Mada" 20"Malinké" 21"Maure" 22"Mende" 23"Ndau" 24"Ndebele" 25"Ngoni" 26"Nyanja" 27"Peulh" 28"Sena" 29"Senga" 30"Tonga" 31"Tumbuka" 32"Vai" 33"Venda" 34"Yoruba" 102"Bariba" 103"Dendi" 105"Ditamari" 107"Yoa" 108"Boo" 109"Waama" 110"Natimba" 140"Mokgatla" 141"Mokwena" 142"Mongwato" 143"Mongwaketse" 144"Motlokwa" 145"Moherero" 146"Morolong" 147"Mosarwa" 148"Mokalaka/Mokalanga" 149"Mosubeya" 150"Motawana" 151"Mokgalagadi" 152"Moyeyi/Moyei" 153"Mohurutshe" 154"Mokhurutshe" 155"Mmirwa" 156"Mongologa" 157"Modamara" 158"Mombukushu" 159"Molete" 160"Motswapong" 161"Motlharo" 162"Motlhaping" 163"Mokgothu" 164"Motalaote" 165"Mopedi" 180"Mossi" 181"Dioula" 182"Peulh" 183"Goumantche" 184"Gourounsi" 185"Bissa" 187"Birifor" 188"Dagari" 189"Lobi" 190"Samo" 191"Sénoufo" 192"Bwaba" 193"Goin" 194"Yanan" 195"Marka" 196"Kassena" 197"Fulse" 198"Toussian" 220"Related to regional origin (badio/sampadjudo)" 221"African" 222"American or european" 223"Related to age" 224"Related to gender" 225"Related to occupation" 226"Related to religion" 227"Related to class" 228"Related to race" 261"Ewe/Anglo" 262"Ga/Adangbe" 263"Dagomba" 265"Dagarti" 266"Waale" 267"Mosi" 268"Sissala" 269"Kontonkoli" 270"Talensi" 271"Kasina" 272"Frafra" 273"Gruma" 274"Bimoba" 275"Bulsa" 276"Nandom" 277"Kusasi" 278"Mamprusi" 280"Guan" 281"Gonja" 282"Nzema" 283"Other Northern tribes" 300"Kikuyu" 301"Luo" 302"Luhya" 303"Kamba" 304"Kalenjin" 305"Kisii" 306"Meru / Embu" 307"Maasai / Samburu" 308"Mijikenda" 309"Taita" 310"Somali" 311"Pokot" 312"Turkana" 313"Tharaka" 314"Teso" 315"Sabaot" 316"Rendile" 317"Pokomo" 318"Mbeere" 319"Kuria" 320"Borana" 321"Arabic" 322"Oroma" 340"Mokoena" 341"Motaung" 342"Mohlakoana/Motebang" 343"Mofokeng" 344"Mosiea" 345"Motsoeneng" 346"Motloung" 347"Lephuthing" 348"Mophuthi" 349"Motlokoa" 350"Letebele" 351"Lekholokoe" 352"Lekhoakhoa" 353"Mokubung" 354"Mothepu" 355"Mokhatla" 380"Bassa" 381"Belle" 382"Dei" 383"Gbandi" 384"Gio" 385"Gola" 386"Grebo" 388"Kpelle" 389"Krahn" 391"Lorma" 392"Mandingo" 393"Mano" 420"Antakarana" 421"Antambahoaka" 422"Antandroy" 423"Antanosy" 424"Antefasy" 425"Antemoro" 426"Antesaka" 427"Bara" 428"Betsileo" 429"Betsimisaraka" 430"Bezanozano" 431"Mahafaly" 432"Merina" 433"Sakalava" 434"Sihanaka" 435"Tanala" 436"Tsimihety" 437"Vezo" 438"Makoa" 439"Sahafatra" 440"Tealaotra" 441"Zafisoro" 461"Nkhonde" 462"Lambya" 463"Chewa" 464"Yao" 465"Ngoni" 467"Mang’anja" 469"Sukwa" 472"Ndali" 501"Bambara" 502"Bella" 504"Bozo" 506"Dogon" 509"Kakolo" 510"Khassonké" 513"Mianka" 514"Peulh / Fulfude" 515"Samogo" 516"Senufo" 517"Soninké / Sarakollé" 518"Sonrhaï" 519"Tamasheq" 540"Makua" 544"Changana" 545"Chope" 546"Bitonga" 547"Makonde" 548"Chuabo" 549"Ajaua" 551"Barue" 552"Marenge" 553"Nhungue" 554"Tewe" 555"Matswa" 556"Tawala" 557"Muani" 559"Manhawa" 560"Ronga" 561"Tacuane" 562"Manica" 564"Gorongozi" 580"Wambo" 581"Herero" 582"Caprivian" 583"Kavango (Rukwangali, Rumanyo, Hambukushu)" 584"German" 587"Portuguese" 588"Nama" 589"Damara" 591"Subia" 593"Tswana" 594"Baster" 621"Igbo" 623"Efik" 624"Ebira" 625"Fulani" 626"Isoko" 627"Ibibio" 628"Kanuri" 629"Tiv" 630"Nupe" 631"Ijaw" 632"Edo" 633"Igala" 634"Urhobo" 635"Idoma" 636"Itsekiri" 637"Ikwere" 638"Awori" 639"Tapa" 640"Kalabari" 641"Birom" 642"Shuwa-Arab" 643"Jukun" 644"Gwari" 645"Ogoni" 646"Anang" 647"Yakhor" 648"Okpella" 649"Tarok" 650"Esan" 651"Ika" 652"Gbagyi" 653"Okrika" 654"Bajju" 655"Gwoza" 656"Ibaji" 657"Kataf" 658"Migili" 660"Wolof" 661"Pulaar/Toucouleur" 662"Serer" 663"Mandinka/Bambara" 664"Soninke" 665"Diola" 666"Manjack" 668"BAYNOUK" 669"BALANTE" 703"Xhosa" 704"Pedi/Spedi/North Sotho" 705"Sesotho/Sotho/South Sotho" 706"Setswana/Tswana" 707"Shangaan" 708"Swazi" 710"Zulu" 711"White/European" 713"Indian" 740"Kinyakyusa" 741"Kichaga" 742"Kihaya" 743"Kingoni" 744"Kikwere" 745"Kipare" 746"Kihehe" 747"Kimakonde" 748"Kinyamwezi" 749"Kisukuma" 750"Kimasai" 751"Kimeru" 752"Kikurya" 753"Kigogo" 754"Kiluguru" 755"Kifipa" 756"Kimanyema" 757"Kinyiramba" 758"Kinyaturu" 759"Mbena" 760"Mha" 761"Mhangaza" 762"Muiraqi" 763"Mjaluo" 764"Mjita" 765"Mkinga" 766"Mtongwe" 767"Mmwera" 768"Mndali" 769"Mndendeule" 770"Mnyambo" 771"Mpogoro" 772"Msambaa" 773"Myao" 774"Mzaramo" 775"Mzigua" 776"Mzinza" 777"Mdoe" 778"Muarusha" 779"Msumbwa" 780"Muganda" 781"Munyankole" 782"Munyoro" 783"Musoga" 784"Mugishu" 785"Mukhonjo" 786"Munyole" 787"Ateso" 788"Acholi" 789"Alur" 790"Lugbara" 791"Madi" 792"Japhadhola" 793"Musamia" 794"Mugwere" 795"Mukiga" 796"Mutooro" 797"Langi" 798"Sabinyi" 799"Karamajong" 800"Mutagwenda" 801"Mufumbira" 802"Munyarwanda" 803"Mululi" 804"Aringa" 805"Kumam" 806"Kakwa" 807"Mulamogi" 808"Aliba" 820"Bemba" 825"Nsenga" 827"Kaonde" 828"Luvale" 829"Namwanga" 830"Lunda" 831"Bisa" 832"Nkoya" 833"Mambwe" 834"Lenje" 836"Soli" 837"Ila" 838"Ushi" 840"Mbunda" 841"Kunda" 842"Lala" 843"Lamba" 844"Lungu" 847"Tokaleya" 848"Bwile" 849"Ngumbo" 851"Tabwa" 852"Goba" 861"Shona" 862"Zezuru" 863"Korekore" 864"Karanga" 865"Manyika" 868"Kalanga" 870"Vhitori" 871"Shangani" 872"Nambya" 873"Maungwe" 874"Buja" 875"Bocha" 876"Sotho" 878"Mixed race" 879"Hwesa" 880"Chikunda" 881"Chewa" 882"Shangwe" 883"Malawian" 900"Afro-Mauritian (Creole)" 901"Chenese" 902"Euro-Mauritian (white)" 903"Hindu" 904"Marathi" 905"Muslim" 906"Tamil" 907"Telegu" 930"Creole" 931"Fulla" 933"Kono" 935"Kuranko" 936"Limba" 937"Loko" 938"Madingo" 940"Sherbro" 941"Susu" 942"Temne" 944"Yalunka" 1101"Zarrma/Songhaï" 1103"Touareg" 1104"Kanouri" 1105"Gourmatché" 1107"Toubou" 1140"Ewé" 1141"Mina (Guen)" 1142"Kabyè" 1143"Tem (Kotokoli)" 1144"Ben (Moba)" 1145"Nawdem (Losso)" 1146"Lama (Lamba)" 1147"Ifè (Ana)" 1148"Ikposso (Akposso)" 1149"N’Tcha (Bassar)" 1152"Ouatchi" 1153"Akébou" 1154"Gourma" 1156"Ngam-Gam" 1157"Tchamba" 1159"Aklobo" 1160"Tchokossi (Anoufom)" 1180"Hutu" 1181"Tutsi" 1182"Twa" 1220"Beti" 1221"Bameleké" 1222"Sawa" 1224"Nso" 1225"Bakweri" 1226"Basa" 1227"Baya" 1228"Arabe choua" 1229"Bafia" 1230"Bafut" 1231"Bakassi" 1232"Bakundu" 1233"Bali Gashu" 1235"Bamoun" 1236"Bangwa" 1237"Batanga" 1238"Batibo" 1239"Bayangi" 1240"Daba" 1241"Dii" 1242"Fali" 1243"Foulbé" 1245"Guidar" 1246"Guiziga" 1247"Hina" 1248"Kapsiki" 1249"Kotoko" 1251"Mafa" 1252"Maka" 1253"Mandara" 1254"Mankon" 1255"Massa" 1256"Mbamois" 1257"Mbo" 1258"Mboum" 1259"Moudang" 1261"Krou" 1262"Mandé du Nord" 1263"Mandé du Sud" 1264"Gur (Voltaïque)" 1300"Soussou" 1303"Guérzé" 1304"Kissien" 1305"Toma" 1306"Djalounké" 1307"Kouranko" 1308"Landouma" 1309"Diakanké" 2220"Mousgoum" 2221"Njikwa" 2222"Oku" 2223"Peule" 2224"Tikari" 2225"Toupouri" 2226"Wimbum" 2227"Yamba" 2621"Chamba" 2622"Jaba" 2740"Misubi" 2741"Misimbiti" 2742"Mkerewe" 2743"Mmbulu" 2744"Msangu" 2745"Mmakua" 2746"Mkwaya" 2747"Msafwa" 2748"Mrangi" 2749"Mpangwa" 2750"Mndengereko" 2751"Mngindo" 2752"Mnguu" 2753"Mnyiha" 2754"Mnyamwanga" 2755"Mtumbatu" 2756"Mswahili" 2757"Mshirazi" 2758"Mpemba" 2759"Mnyasa" 2760"Mgunya" 9990"National identity only, or doesn't think of self in those terms" 9995"Others" 9997"Not asked" 9998"Refused" 9999"Don't know" -1"Missing"
label value q84 ethnic
decode q84, generate(ethnic2)

drop if q102!=1 // Respondent's ethnic group=Black/African

gen murdock_name=upper(ethnic2)
replace murdock_name=upper(ustrto(ustrnormalize(murdock_name,"nfd"),"ascii", 2))
replace murdock_name="" if murdock_name=="DON'T KNOW"
replace murdock_name="DAGARI" if murdock_name=="DAGARTI"
replace murdock_name="ADAMAWA" if murdock_name=="DABA"
replace murdock_name="ADAMAWA" if murdock_name=="FOULBE"
replace murdock_name="AKPOSO" if murdock_name=="IKPOSSO (AKPOSSO)"
replace murdock_name="AMBO" if murdock_name=="WAMBO"
replace murdock_name="ANA" if murdock_name=="IFE (ANA)"
replace murdock_name="ANTAISAKA" if murdock_name=="ANTAMBAHOAKA"
replace murdock_name="ANTAISAKA" if murdock_name=="ANTEFASY"
replace murdock_name="ANTAISAKA" if murdock_name=="ANTEMORO"
replace murdock_name="ANTAISAKA" if murdock_name=="ANTESAKA"
replace murdock_name="ANTANDROY" if murdock_name=="ANTANOSY"
replace murdock_name="ANYANG" if murdock_name=="BAYANGI"
replace murdock_name="ASHANTI" if murdock_name=="AKAN"
replace murdock_name="ASSINI" if murdock_name=="NZEMA"
replace murdock_name="AULLIMINDEN" if murdock_name=="TAMASHEQ"
replace murdock_name="AUSHI" if murdock_name=="USHI"
replace murdock_name="BAMBARA" if murdock_name=="MANDINKA/BAMBARA"
replace murdock_name="BAMILEKE" if murdock_name=="BAMELEKE"
replace murdock_name="BAMILEKE" if murdock_name=="BANGWA"
replace murdock_name="BANYUN" if murdock_name=="BAYNOUK"
replace murdock_name="BARARETTA" if murdock_name=="SOMALI"
replace murdock_name="BARGU" if murdock_name=="BARIBA"
replace murdock_name="BARGU" if murdock_name=="BOO"
replace murdock_name="BARGU" if murdock_name=="PEULH"
replace murdock_name="BASARI" if murdock_name=="NTCHA (BASSAR)"
replace murdock_name="BAUCHI" if murdock_name=="FULANI"
replace murdock_name="BENA" if murdock_name=="MBENA"
replace murdock_name="BENDE" if murdock_name=="MPANGWA"
replace murdock_name="BERGDAMA" if murdock_name=="MODAMARA"
replace murdock_name="BERGDAMA" if murdock_name=="DAMARA"
replace murdock_name="BIRIFON" if murdock_name=="BIRIFOR"
replace murdock_name="BISA" if murdock_name=="BISSA"
replace murdock_name="BOBO" if murdock_name=="BWABA"
replace murdock_name="BORAN" if murdock_name=="BORANA"
replace murdock_name="BUDJA" if murdock_name=="BUJA"
replace murdock_name="BUILSA" if murdock_name=="BULSA"
replace murdock_name="Cannot match to Murdock name" if murdock_name=="BASTER"
replace murdock_name="CHAGA" if murdock_name=="KICHAGA"
replace murdock_name="CHAGA" if murdock_name=="KIMERU"
replace murdock_name="CHAKOSSI" if murdock_name=="NGAM-GAM"
replace murdock_name="CHAKOSSI" if murdock_name=="TCHOKOSSI (ANOUFOM)"
replace murdock_name="CHAKOSSI" if murdock_name=="SHONA"
replace murdock_name="CHAMBA" if murdock_name=="TCHAMBA"
replace murdock_name="CHIGA" if murdock_name=="MUKIGA"
replace murdock_name="CHOPI" if murdock_name=="BITONGA"
replace murdock_name="CHOPI" if murdock_name=="CHOPE"
replace murdock_name="DAFI" if murdock_name=="DAFING"
replace murdock_name="DAFI" if murdock_name=="SENOUFO"
replace murdock_name="DAGARI" if murdock_name=="DAGARTI"
replace murdock_name="DAGARI" if murdock_name=="SISSALA"
replace murdock_name="DEFORO" if murdock_name=="FULSE"
replace murdock_name="DIALONKE" if murdock_name=="DJALOUNKE"
replace murdock_name="DIOLA" if murdock_name=="DIOULA"
replace murdock_name="DURU" if murdock_name=="DII"
replace murdock_name="EDO" if murdock_name=="ESAN"
replace murdock_name="EDO" if murdock_name=="OKPELLA"
replace murdock_name="EGBA" if murdock_name=="AWORI"
replace murdock_name="EWE" if murdock_name=="EWE/ANGLO"
replace murdock_name="EWE" if murdock_name=="MINA (GUEN)"
replace murdock_name="EWE" if murdock_name=="OUATCHI"
replace murdock_name="FAJULU" if murdock_name=="KAKWA"
replace murdock_name="FANG" if murdock_name=="BETI"
replace murdock_name="FIA" if murdock_name=="BAFIA"
replace murdock_name="FIPA" if murdock_name=="KIFIPA"
replace murdock_name="FON" if murdock_name=="ADJA"
replace murdock_name="FUT" if murdock_name=="BAFUT"
replace murdock_name="GA" if murdock_name=="GA/ADANGBE"
replace murdock_name="GANDA" if murdock_name=="MUGANDA"
replace murdock_name="GBANDE" if murdock_name=="GBANDI"
replace murdock_name="GBARI" if murdock_name=="GBAGYI"
replace murdock_name="GBARI" if murdock_name=="GWARI"
replace murdock_name="GILI" if murdock_name=="MIGILI"
replace murdock_name="GISIGA" if murdock_name=="GUIZIGA"
replace murdock_name="GISU" if murdock_name=="MUGISHU"
replace murdock_name="GOGO" if murdock_name=="KIGOGO"
replace murdock_name="GRUNSHI" if murdock_name=="GOUROUNSI"
replace murdock_name="GRUNSHI" if murdock_name=="KASSENA"
replace murdock_name="GUANG" if murdock_name=="GONJA"
replace murdock_name="GUANG" if murdock_name=="GUAN"
replace murdock_name="GUDE" if murdock_name=="GUIDAR"
replace murdock_name="GUDE" if murdock_name=="HINA"
replace murdock_name="GUIN" if murdock_name=="GOIN"
replace murdock_name="GURENSI" if murdock_name=="FRAFRA"
replace murdock_name="GURENSI" if murdock_name=="KASINA"
replace murdock_name="GURENSI" if murdock_name=="KUSASI"
replace murdock_name="GURENSI" if murdock_name=="NANDOM"
replace murdock_name="GURENSI" if murdock_name=="TALENSI"
replace murdock_name="GURMA" if murdock_name=="GOUMANTCHE"
replace murdock_name="GURMA" if murdock_name=="GRUMA"
replace murdock_name="GURMA" if murdock_name=="GOURMA"
replace murdock_name="GURO" if murdock_name=="GUR (VOLTAIQUE)"
replace murdock_name="GURO" if murdock_name=="MANDE DU SUD"
replace murdock_name="GUSII" if murdock_name=="KISII"
replace murdock_name="GUSII" if murdock_name=="KURIA"
replace murdock_name="GUSII" if murdock_name=="KIKURYA"
replace murdock_name="GUSII" if murdock_name=="MKWAYA"
replace murdock_name="HA" if murdock_name=="MHA"
replace murdock_name="HA" if murdock_name=="MISUBI"
replace murdock_name="HADIMU" if murdock_name=="MGUNYA"
replace murdock_name="HADIMU" if murdock_name=="MSHIRAZI"
replace murdock_name="HADIMU" if murdock_name=="MTUMBATU"
replace murdock_name="HAUSA" if murdock_name=="HAOUSSA"
replace murdock_name="HAYA" if murdock_name=="KIHAYA"
replace murdock_name="HAYA" if murdock_name=="MNYAMBO"
replace murdock_name="HEHE" if murdock_name=="KIHEHE"
replace murdock_name="HERERO" if murdock_name=="MOHERERO"
replace murdock_name="HURUTSHE" if murdock_name=="MOHURUTSHE"
replace murdock_name="HURUTSHE" if murdock_name=="MOKHURUTSHE"
replace murdock_name="HURUTSHE" if murdock_name=="SETSWANA/TSWANA"
replace murdock_name="IBIBIO" if murdock_name=="ANANG"
replace murdock_name="IBIBIO" if murdock_name=="EFIK"
replace murdock_name="IBIBIO" if murdock_name=="OGONI"
replace murdock_name="IBO" if murdock_name=="IGBO"
replace murdock_name="IBO" if murdock_name=="IKA"
replace murdock_name="IBO" if murdock_name=="IKWERE"
replace murdock_name="IGALA" if murdock_name=="IBAJI"
replace murdock_name="IGBIRA" if murdock_name=="EBIRA"
replace murdock_name="IJAW" if murdock_name=="KALABARI"
replace murdock_name="IJAW" if murdock_name=="OKRIKA"
replace murdock_name="IRAMBA" if murdock_name=="KINYIRAMBA"
replace murdock_name="IRAQW" if murdock_name=="MMBULU"
replace murdock_name="IRAQW" if murdock_name=="MUIRAQI"
replace murdock_name="ISOKO" if murdock_name=="URHOBO"
replace murdock_name="IWA" if murdock_name=="MNYAMWANGA"
replace murdock_name="IWA" if murdock_name=="NAMWANGA"
replace murdock_name="KABRE" if murdock_name=="KABYE"
replace murdock_name="KAGORO" if murdock_name=="KAKOLO"
replace murdock_name="KANURI" if murdock_name=="KANOURI"
replace murdock_name="KARAMOJONG" if murdock_name=="KARAMAJONG"
replace murdock_name="KARANGA" if murdock_name=="MOKALAKA/MOKALANGA"
replace murdock_name="KARANGA" if murdock_name=="KALANGA"
replace murdock_name="KASONKE" if murdock_name=="KHASSONKE"
replace murdock_name="KATAB" if murdock_name=="KATAF"
replace murdock_name="KEBU" if murdock_name=="AKEBOU"
replace murdock_name="KEREWE" if murdock_name=="KIKWERE"
replace murdock_name="KGALAGADI" if murdock_name=="MOKGALAGADI"
replace murdock_name="KGATLA" if murdock_name=="MOKGATLA"
replace murdock_name="KINGA" if murdock_name=="MKINGA"
replace murdock_name="KIPSIGI" if murdock_name=="KALENJIN"
replace murdock_name="KISSI" if murdock_name=="KISSIEN"
replace murdock_name="KOBA" if murdock_name=="MOYEYI/MOYEI"
replace murdock_name="KOM" if murdock_name=="OKU"
replace murdock_name="KONJO" if murdock_name=="MUKHONJO"
replace murdock_name="KORANKO" if murdock_name=="KOURANKO"
replace murdock_name="KORANKO" if murdock_name=="KURANKO"
replace murdock_name="KOSSI" if murdock_name=="BAKASSI"
replace murdock_name="KOSSI" if murdock_name=="MBO"
replace murdock_name="KPE" if murdock_name=="BAKWERI"
replace murdock_name="KPELLE" if murdock_name=="GUERZE"
replace murdock_name="KRACHI" if murdock_name=="KONTONKOLI"
replace murdock_name="KRAN" if murdock_name=="KRAHN"
replace murdock_name="KRU" if murdock_name=="KROU"
replace murdock_name="KUNDA" if murdock_name=="NHUNGUE"
replace murdock_name="KUNDA" if murdock_name=="CHIKUNDA"
replace murdock_name="KUNDU" if murdock_name=="BAKUNDU"
replace murdock_name="KWANGARE" if murdock_name=="KAVANGO (RUKWANGALI, RUMANYO, HAMBUKUSHU)"
replace murdock_name="KWENA" if murdock_name=="MOKWENA"
replace murdock_name="KWERE" if murdock_name=="MDOE"
replace murdock_name="KWERE" if murdock_name=="MKEREWE"
replace murdock_name="LAMBA" if murdock_name=="LAMA (LAMBA)"
replace murdock_name="LANDUMA" if murdock_name=="LANDOUMA"
replace murdock_name="LANGO" if murdock_name=="KUMAM"
replace murdock_name="LANGO" if murdock_name=="LANGI"
replace murdock_name="LENJE" if murdock_name=="SOLI"
replace murdock_name="LOMWE" if murdock_name=="TACUANE"
replace murdock_name="LOZI" if murdock_name=="CAPRIVIAN"
replace murdock_name="LUGBARA" if murdock_name=="ALIBA"
replace murdock_name="LUGBARA" if murdock_name=="ARINGA"
replace murdock_name="LUGURU" if murdock_name=="KILUGURU"
replace murdock_name="LUNGU" if murdock_name=="MAMBWE"
replace murdock_name="LUO" if murdock_name=="MJALUO"
replace murdock_name="LUO" if murdock_name=="JAPHADHOLA"
replace murdock_name="MAGWANGARA" if murdock_name=="MNDENDEULE"
replace murdock_name="MAKONDE" if murdock_name=="MUANI"
replace murdock_name="MAKONDE" if murdock_name=="KIMAKONDE"
replace murdock_name="MAKUA" if murdock_name=="MAKOA"
replace murdock_name="MAKUA" if murdock_name=="MMAKUA"
replace murdock_name="MALINKE" if murdock_name=="MANDE DU NORD"
replace murdock_name="MALINKE" if murdock_name=="MANDINGO"
replace murdock_name="MALINKE" if murdock_name=="MADINGO"
replace murdock_name="MANYIKA" if murdock_name=="BARUE"
replace murdock_name="MANYIKA" if murdock_name=="MANICA"
replace murdock_name="MANYIKA" if murdock_name=="TEWE"
replace murdock_name="MASA" if murdock_name=="MASSA"
replace murdock_name="MASAI" if murdock_name=="MAASAI / SAMBURU"
replace murdock_name="MASAI" if murdock_name=="KIMASAI"
replace murdock_name="MATAKAM" if murdock_name=="MAFA"
replace murdock_name="MAURI" if murdock_name=="MAURE"
replace murdock_name="MBUKUSHU" if murdock_name=="MOMBUKUSHU"
replace murdock_name="MBUM" if murdock_name=="MBOUM"
replace murdock_name="MERU" if murdock_name=="MERU / EMBU"
replace murdock_name="MERU" if murdock_name=="THARAKA"
replace murdock_name="MINIANKA" if murdock_name=="MIANKA"
replace murdock_name="MOBA" if murdock_name=="BIMOBA"
replace murdock_name="MOBA" if murdock_name=="BEN (MOBA)"
replace murdock_name="MOSSI" if murdock_name=="YANAN"
replace murdock_name="MOSSI" if murdock_name=="MOSI"
replace murdock_name="MUM" if murdock_name=="BAMOUN"
replace murdock_name="MUNDANG" if murdock_name=="MOUDANG"
replace murdock_name="MUSGU" if murdock_name=="MOUSGOUM"
replace murdock_name="MWERA" if murdock_name=="MMWERA"
replace murdock_name="NAUDEBA" if murdock_name=="NAWDEM (LOSSO)"
replace murdock_name="NDOB" if murdock_name=="BALI GASHU"
replace murdock_name="NDOB" if murdock_name=="TIKARI"
replace murdock_name="NGERE" if murdock_name=="GIO"
replace murdock_name="NGERE" if murdock_name=="MANO"
replace murdock_name="NGINDO" if murdock_name=="MNGINDO"
replace murdock_name="NGONI" if murdock_name=="NGONI"
replace murdock_name="NGURU" if murdock_name=="MNGUU"
replace murdock_name="NGWAKETSE" if murdock_name=="MONGWAKETSE"
replace murdock_name="NGWATO" if murdock_name=="MONGWATO"
replace murdock_name="NGWATO" if murdock_name=="MOPEDI"
replace murdock_name="NGWATO" if murdock_name=="MOTALAOTE"
replace murdock_name="NGWATO" if murdock_name=="MOTSWAPONG"
replace murdock_name="NKOLE" if murdock_name=="MUNYANKOLE"
replace murdock_name="NSAW" if murdock_name=="NSO"
replace murdock_name="NSAW" if murdock_name=="SAWA"
replace murdock_name="NSUNGLI" if murdock_name=="WIMBUM"
replace murdock_name="NUPE" if murdock_name=="TAPA"
replace murdock_name="NUSAN" if murdock_name=="MOSARWA"
replace murdock_name="NYAKYUSA" if murdock_name=="NDALI"
replace murdock_name="NYAKYUSA" if murdock_name=="NKHONDE"
replace murdock_name="NYAKYUSA" if murdock_name=="SUKWA"
replace murdock_name="NYAKYUSA" if murdock_name=="KINYAKYUSA"
replace murdock_name="NYAKYUSA" if murdock_name=="MNDALI"
replace murdock_name="NYAKYUSA" if murdock_name=="MNYIHA"
replace murdock_name="NYAMWEZI" if murdock_name=="KIMANYEMA"
replace murdock_name="NYAMWEZI" if murdock_name=="KINYAMWEZI"
replace murdock_name="NYANJA" if murdock_name=="MANGANJA"
replace murdock_name="NYANJA" if murdock_name=="MARENGE"
replace murdock_name="NYASA" if murdock_name=="MNYASA"
replace murdock_name="NYORO" if murdock_name=="MUNYORO"
replace murdock_name="NYORO" if murdock_name=="MUTAGWENDA"
replace murdock_name="OROMO" if murdock_name=="OROMA"
replace murdock_name="PARE" if murdock_name=="KIPARE"
replace murdock_name="PEDI" if murdock_name=="PEDI/SPEDI/NORTH SOTHO"
replace murdock_name="PEMBA" if murdock_name=="MPEMBA"
replace murdock_name="PEMBA" if murdock_name=="MSWAHILI"
replace murdock_name="PEPEL" if murdock_name=="MANJACK"
replace murdock_name="POGORO" if murdock_name=="MPOGORO"
replace murdock_name="PUKU" if murdock_name=="BATANGA"
replace murdock_name="RANGI" if murdock_name=="MRANGI"
replace murdock_name="ROLONG" if murdock_name=="MOROLONG"
replace murdock_name="RONGA" if murdock_name=="MATSWA"
replace murdock_name="RUANDA" if murdock_name=="MUFUMBIRA"
replace murdock_name="RUANDA" if murdock_name=="MUNYARWANDA"
replace murdock_name="RUNDI" if murdock_name=="HUTU"
replace murdock_name="RUNDI" if murdock_name=="TUTSI"
replace murdock_name="RUNDI" if murdock_name=="TWA"
replace murdock_name="RUNDI" if murdock_name=="MHANGAZA"
replace murdock_name="SABEI" if murdock_name=="SABAOT"
replace murdock_name="SABEI" if murdock_name=="SABINYI"
replace murdock_name="SAFWA" if murdock_name=="MSAFWA"
replace murdock_name="SAKALAVA" if murdock_name=="ANTAKARANA"
replace murdock_name="SAKALAVA" if murdock_name=="VEZO"
replace murdock_name="SAMIA" if murdock_name=="MUSAMIA"
replace murdock_name="SAMO" if murdock_name=="SAMOGO"
replace murdock_name="SANGU" if murdock_name=="MSANGU"
replace murdock_name="SEGEJU" if murdock_name=="MIJIKENDA"
replace murdock_name="SHAMBALA" if murdock_name=="MSAMBAA"
replace murdock_name="SHASHI" if murdock_name=="MJITA"
replace murdock_name="SHUWA" if murdock_name=="SHUWA-ARAB"
replace murdock_name="SINZA" if murdock_name=="MZINZA"
replace murdock_name="SOGA" if murdock_name=="MUGWERE"
replace murdock_name="SOGA" if murdock_name=="MULAMOGI"
replace murdock_name="SOGA" if murdock_name=="MUSOGA"
replace murdock_name="SOMBA" if murdock_name=="DITAMARI"
replace murdock_name="SOMBA" if murdock_name=="NATIMBA"
replace murdock_name="SOMBA" if murdock_name=="WAAMA"
replace murdock_name="SOMBA" if murdock_name=="YOA"
replace murdock_name="SONGHAI" if murdock_name=="MBEERE"
replace murdock_name="SONGHAI" if murdock_name=="SONRHAI"
replace murdock_name="SONINKE" if murdock_name=="MARKA"
replace murdock_name="SONINKE" if murdock_name=="MBAMOIS"
replace murdock_name="SONINKE" if murdock_name=="SONINKE / SARAKOLLE"
replace murdock_name="SOTHO" if murdock_name=="LEKHOAKHOA"
replace murdock_name="SOTHO" if murdock_name=="LEKHOLOKOE"
replace murdock_name="SOTHO" if murdock_name=="LEPHUTHING"
replace murdock_name="SOTHO" if murdock_name=="LETEBELE"
replace murdock_name="SOTHO" if murdock_name=="MOFOKENG"
replace murdock_name="SOTHO" if murdock_name=="MOHLAKOANA/MOTEBANG"
replace murdock_name="SOTHO" if murdock_name=="MOKHATLA"
replace murdock_name="SOTHO" if murdock_name=="MOKOENA"
replace murdock_name="SOTHO" if murdock_name=="MOKUBUNG"
replace murdock_name="SOTHO" if murdock_name=="MOPHUTHI"
replace murdock_name="SOTHO" if murdock_name=="MOSIEA"
replace murdock_name="SOTHO" if murdock_name=="MOTAUNG"
replace murdock_name="SOTHO" if murdock_name=="MOTHEPU"
replace murdock_name="SOTHO" if murdock_name=="MOTLOKOA"
replace murdock_name="SOTHO" if murdock_name=="MOTLOUNG"
replace murdock_name="SOTHO" if murdock_name=="MOTSOENENG"
replace murdock_name="SOTHO" if murdock_name=="SESOTHO/SOTHO/SOUTH SOTHO"
replace murdock_name="SUBIA" if murdock_name=="MOSUBEYA"
replace murdock_name="SUK" if murdock_name=="POKOT"
replace murdock_name="SUKUMA" if murdock_name=="KISUKUMA"
replace murdock_name="SUMBWA" if murdock_name=="MSUMBWA"
replace murdock_name="SUSU" if murdock_name=="SOUSSOU"
replace murdock_name="TABWA" if murdock_name=="BWILE"
replace murdock_name="TANALA" if murdock_name=="BEZANOZANO"
replace murdock_name="TAWANA" if murdock_name=="MOTAWANA"
replace murdock_name="TAWARA" if murdock_name=="TAWALA"
replace murdock_name="TEDA" if murdock_name=="TOUBOU"
replace murdock_name="TEITA" if murdock_name=="TAITA"
replace murdock_name="TEKNA" if murdock_name=="BELLA"
replace murdock_name="TEM" if murdock_name=="TEM (KOTOKOLI)"
replace murdock_name="TESO" if murdock_name=="ATESO"
replace murdock_name="THONGA" if murdock_name=="CHANGANA"
replace murdock_name="THONGA" if murdock_name=="SHANGAAN"
replace murdock_name="TIGON" if murdock_name=="YAMBA"
replace murdock_name="TLOKWA" if murdock_name=="MMIRWA"
replace murdock_name="TLOKWA" if murdock_name=="MOLETE"
replace murdock_name="TLOKWA" if murdock_name=="MOTLOKWA"
replace murdock_name="TOMA" if murdock_name=="BELLE"
replace murdock_name="TOMA" if murdock_name=="LORMA"
replace murdock_name="TONGA" if murdock_name=="TOKALEYA"
replace murdock_name="TUBURI" if murdock_name=="TOUPOURI"
replace murdock_name="TUKULOR" if murdock_name=="PULAAR/TOUCOULEUR"
replace murdock_name="TURU" if murdock_name=="KINYATURU"
replace murdock_name="TURU" if murdock_name=="MUTOORO"
replace murdock_name="TUSYAN" if murdock_name=="TOUSSIAN"
replace murdock_name="WABA" if murdock_name=="WAALE"
replace murdock_name="WAKURA" if murdock_name=="GWOZA"
replace murdock_name="WANGA" if murdock_name=="LUHYA"
replace murdock_name="WANGA" if murdock_name=="MUNYOLE"
replace murdock_name="WIDEKUM" if murdock_name=="NJIKWA"
replace murdock_name="XOSA" if murdock_name=="XHOSA"
replace murdock_name="YAO" if murdock_name=="AJAUA"
replace murdock_name="YAO" if murdock_name=="MYAO"
replace murdock_name="ZARAMO" if murdock_name=="MNDENGEREKO"
replace murdock_name="ZARAMO" if murdock_name=="MZARAMO"
replace murdock_name="ZERMA" if murdock_name=="GOURMATCHE"
replace murdock_name="ZERMA" if murdock_name=="ZARRMA/SONGHAI"
replace murdock_name="ZEZURU" if murdock_name=="MAUNGWE"
replace murdock_name="ZIGULA" if murdock_name=="MZIGUA"
***
replace murdock_name="" if murdock_name=="NATIONAL IDENTITY ONLY, OR DOESN'T THINK OF SELF IN THOSE TERMS"
replace murdock_name="" if murdock_name=="OTHERS"
replace murdock_name="" if murdock_name=="REFUSED"
replace murdock_name="" if murdock_name=="MOKGOTHU"
replace murdock_name="" if murdock_name=="MONGOLOGA"
replace murdock_name="" if murdock_name=="MOTLHAPING"
replace murdock_name="" if murdock_name=="MOTLHARO"
replace murdock_name="" if murdock_name=="ARABE CHOUA"
replace murdock_name="" if murdock_name=="BATIBO"
replace murdock_name="" if murdock_name=="MANKON"
replace murdock_name="" if murdock_name=="MISSING"
replace murdock_name="" if murdock_name=="PEULE"
replace murdock_name="" if murdock_name=="OTHER NORTHERN TRIBES"
replace murdock_name="" if murdock_name=="DIAKANKE"
replace murdock_name="" if murdock_name=="ARABE"
replace murdock_name="" if murdock_name=="DEI"
replace murdock_name="" if murdock_name=="ENGLISH"
replace murdock_name="" if murdock_name=="SAHAFATRA"
replace murdock_name="" if murdock_name=="TEALAOTRA"
replace murdock_name="" if murdock_name=="ZAFISORO"
replace murdock_name="" if murdock_name=="PEULH / FULFUDE"
replace murdock_name="" if murdock_name=="GORONGOZI"
replace murdock_name="" if murdock_name=="MANHAWA"
replace murdock_name="" if murdock_name=="AFRIKAANER"
replace murdock_name="" if murdock_name=="COLOURED"
replace murdock_name="" if murdock_name=="PORTUGUESE"
replace murdock_name="" if murdock_name=="TSWANA"
replace murdock_name="" if murdock_name=="TOUAREG"
replace murdock_name="" if murdock_name=="BAJJU"
replace murdock_name="" if murdock_name=="JABA"
replace murdock_name="" if murdock_name=="TAROK"
replace murdock_name="" if murdock_name=="YAKHOR"
replace murdock_name="" if murdock_name=="INDIAN"
replace murdock_name="" if murdock_name=="WHITE/EUROPEAN"
replace murdock_name="" if murdock_name=="CREOLE"
replace murdock_name="" if murdock_name=="FULLA"
replace murdock_name="" if murdock_name=="NOT ASKED"
replace murdock_name="" if murdock_name=="KINGONI"
replace murdock_name="" if murdock_name=="MISIMBITI"
replace murdock_name="" if murdock_name=="MTONGWE"
replace murdock_name="" if murdock_name=="MUARUSHA"
replace murdock_name="" if murdock_name=="AKLOBO"
replace murdock_name="" if murdock_name=="MULULI"
replace murdock_name="" if murdock_name=="GOBA"
replace murdock_name="" if murdock_name=="NGUMBO"
replace murdock_name="" if murdock_name=="BOCHA"
replace murdock_name="" if murdock_name=="HWESA"
replace murdock_name="" if murdock_name=="MALAWIAN"
replace murdock_name="" if murdock_name=="NAMBYA"
replace murdock_name="" if murdock_name=="SHANGANI"
replace murdock_name="" if murdock_name=="SHANGWE"
replace murdock_name="" if murdock_name=="VHITORI"
drop ethnic2


*** Generate individual data
gen age=q1 if q1>0 & q1<990
gen age2=age*age
gen male=(q101==1)
gen urban_dum=(urbrur==1)

keep if q102==1 // Respondent’s race=White/European

gen education=q97 
replace education=. if education==-1 | education>13

egen isocodefe=group(isocode)

gen ln_export_area0=(ln_export_area==0)
gen dist2nationalcity_25=(dist2nationalcity<=25)
gen dist2muslimcentre_25=(dist2muslimcentre<=25)
gen dist2river_25=(dist2river_nav<=25)
gen dist2lake_25=(dist2lake<=25)
gen dist2_dist2explorer_25=(dist2explorer<=25)
gen dist2rail1924_25=(dist2rail1924<=25)

* Drop duplicates that arise because the village coordinates are located on the grid boundary 
duplicates drop respno, force // drop duplicates randomly

** Number of national mission stations
gen n_roome_national=.
replace n_roome_national=6 if isocode=="BDI"
replace n_roome_national=5 if isocode=="BEN"
replace n_roome_national=0 if isocode=="BFO"
replace n_roome_national=4 if isocode=="BOT"
replace n_roome_national=24 if isocode=="CAM"
replace n_roome_national=4 if isocode=="CDI"
replace n_roome_national=26 if isocode=="GHA"
replace n_roome_national=10 if isocode=="GUI"
replace n_roome_national=69 if isocode=="KEN"
replace n_roome_national=12 if isocode=="LES"
replace n_roome_national=6 if isocode=="LIB"
replace n_roome_national=91 if isocode=="MAD"
replace n_roome_national=2 if isocode=="MLI"
replace n_roome_national=4 if isocode=="MLI"
replace n_roome_national=47 if isocode=="MLW"
replace n_roome_national=22 if isocode=="MOZ"
replace n_roome_national=21 if isocode=="NAM"
replace n_roome_national=0 if isocode=="NGR"
replace n_roome_national=143 if isocode=="NIG"
replace n_roome_national=56 if isocode=="SAF"
replace n_roome_national=12 if isocode=="SEN"
replace n_roome_national=20 if isocode=="SRL"
replace n_roome_national=0 if isocode=="SWZ"
replace n_roome_national=107 if isocode=="TAN"
replace n_roome_national=10 if isocode=="TOG"
replace n_roome_national=34 if isocode=="UGA"
replace n_roome_national=64 if isocode=="ZAM"
replace n_roome_national=31 if isocode=="ZIM"
label var n_roome_national "Number of mission stations at the national level according to Roome"

gen n_true=.
replace n_true=101 if isocode=="BEN"
replace n_true=37 if isocode=="BOT"
replace n_true=6 if isocode=="BFO"
replace n_true=150 if isocode=="BDI"
replace n_true=74 if isocode=="CAM"
replace n_true=162 if isocode==""
replace n_true=26 if isocode==""
replace n_true=9 if isocode==""
replace n_true=1223 if isocode=="GHA"
replace n_true=139 if isocode=="KEN"
replace n_true=487 if isocode=="LES"
replace n_true=168 if isocode=="LIB"
replace n_true=2200 if isocode=="MAD"
replace n_true=932 if isocode=="MLW"
replace n_true=6 if isocode=="MLI"
replace n_true=88 if isocode=="NAM"
replace n_true=2987 if isocode=="NIG"
replace n_true=219 if isocode==""
replace n_true=202 if isocode=="SRL"
replace n_true=3 if isocode==""
replace n_true=3856 if isocode=="SAF"
replace n_true=185 if isocode=="SWZ"
replace n_true=401 if isocode=="TAN"
replace n_true=188 if isocode=="TOG"
replace n_true=2515 if isocode=="UGA"
replace n_true=78 if isocode=="ZAM"
label var n_true "True Number of mission stations at the national level according to BB"

** Merge village level data with ethnic level data
merge 1:1 respno using "Appendix Table A12\ethnic.dta", force nogenerate

keep respno education lntotal_missions_nunn loc_missionnunn age age2 male urban_dum murdock_name isocodefe gridcell ///
eth_ln_export_area eth_explorer_contact eth_railway_contact_dissect97 eth_soil5 eth_river_nav10km eth_altitude ///
eth_yrstudy_yn eth_yrstudy1924 eth_prec_mean eth_altitude eth_alt_std eth_soil5 eth_malaria eth_tsetse eth_nslaveports eth_lndist2coast eth_ncity1400 eth_ncity1800 eth_missing_murdock eth_centra eth_date_col_min eth_nevercolonised eth_ldist2muslimcentre eth_ldensity1800m eth_ldist2river eth_nlakecells eth_ldist2lake eth_explorer_contact eth_rail1924 eth_rail1924_25 eth_density1800m eth_nationalcities eth_lcitypop1900 eth_lurbc1900 eth_lrurc1900 eth_slavery eth_ln_export_area eth_lcellvalue1924all eth_mines1924 eth_polygamy ///
eth_lbeach03_pro_yn_0 eth_lbeach03_pro_yn_50 eth_lbeach03_pro_yn_100 ///
loc_explorer_contact dist2lake10km loc_railway_contact_dissect97 ln_export_area soil5 alt_mean ///
yrstudy_yn yrstudy1924 prec_mean alt_mean alt_std soil5 malaria tsetse dist2slaveport_10km lndist2coast city1400 city1800 missing_murdock centra nevercolonised date_col ldist2muslimcentre dist2river_nav10km dist2lake10 dist2explorer10 dist2rail192410 density1800m dist2nationalcity10 lcitypop1900_10 lurbc1900 lrurc1900 slavery ln_export_area lcellvalue1924all mines1924_50km polygamy ///
dist2nationalcity_25 ldist2nationalcity dist2muslimcentre_25 dist2river_25 dist2lake_25 dist2_dist2explorer_25 dist2rail1924_25 ldist2rail1924 loc_ncity1400_25 loc_ncity1800_25 loc_ncity1400_25dum loc_ncity1800_25dum  locn_slaveports_25km loc_density1800m_25 loc_lcitypop1900_25 loc_lurbc1900_25 loc_lrurc1900_25 ///
loc_beach03_pro_yn_0 loc_beach03_pro_yn_50 loc_beach03_pro_yn_100 ///
n_true n_roome_national n_missionnunn

label var murdock_name "Name of ethnic group matched to Murdock"

label var age "Age in years (q1, Afro5)"
label var age2 "Age squared (q1, Afro5)"
label var male "Respondent is male (q101, Afro5)"
label var urban_dum "Location is urban (urbrur, Afro5)"
label var education "Educational attainment (Afro5: q97)"

label var n_missionnunn "N Mission within 25km (Roome map)"
label var gridcell "Gridcell id in which respno's residence is located"
label var alt_mean "Mean altitude of gridcell"
label var prec_mean "Mean precipitation"
label var dist2lake10 "Grid within 10 km of a lake"
label var dist2explorer10 "Grid within 10 km of European explorer route"
label var dist2rail192410 "Grid within 10 km of 1924 railroad"
label var lndist2coast "Log distance to coast (grid)"
label var ldist2rail1924 "Log distance to 1924 railroad (grid)"
label var density1800m "Density of 1800 (grid)"
label var lcitypop1900_10 "Logged city population 1900 (grid), our data"
label var dist2nationalcity10  "Distance to national city (grid)"
label var ldist2nationalcity "Log distance to national city (grid)"
label var lurbc1900 "Log urban headcount 1900 (grid, HYDE)"
label var lrurc1900 "Log rural headcount 1900 (grid, HYDE)"
label var ldist2muslimcentre "Log distance to Muslim centre (grid)"
label var centra "Ethnic group is centralised (from Murdock, grid)"
label var yrstudy1924 "Ethnic group studied by 1924"
label var yrstudy_yn ""
label var lcellvalue1924all "Log cell value 1924 (grid)"
label var isocodefe "Country FE"
label var loc_missionnunn "N Mission stations within 25km" 
label var lntotal_missions_nunn "ln(1+N missions)/area)"
label var loc_beach03_pro_yn_0 "ln(1+N Beach 1800 missions)/area)"
label var loc_beach03_pro_yn_50 "ln(1+N Beach 1850 missions)/area)"
label var loc_beach03_pro_yn_100 "ln(1+N Beach 1900 missions)/area)"
label var loc_density1800m_25 "1800 Population Density within 25 km (grid)"
label var loc_ncity1400_25 "N cities 1400 within 25km (grid)"
label var loc_ncity1800_25 "N cities 1800 within 25km (grid)"
label var locn_slaveports_25km "N slaveports within 25km (grid)"
label var loc_ncity1400_25dum "City 1400 within 25km (grid)"
label var loc_ncity1800_25dum "City 1800 within 25km (grid)"
label var loc_explorer_contact "Ethnic group contacted by European explorer (grid)"
label var loc_railway_contact_dissect97 "Railroad built by 1897 (grid)"
label var loc_lcitypop1900_25 "Log 1900 city population within 25km (grid)"
label var loc_lurbc1900_25 "Log 1900 urban count within 25km (Hyde, grid)"
label var loc_lrurc1900_25 "Log 1900 rural count within 25km (Hyde, grid)"
label var dist2nationalcity_25 "National city within 25km (grid)" 
label var dist2muslimcentre_25  "Muslim centre within 25km (grid)"
label var dist2river_25 "Navigable river within 25km (grid)"
label var dist2lake_25 "Lake within 25km (grid)"
label var dist2_dist2explorer_25 "Explorer route within 25km (grid)"
label var dist2rail1924_25 "Rail withion 25km (grid)"

label var lntotal_missions_nunn "log[(1+n_missionnunn)/eth_area]"
label var eth_lbeach03_pro_yn_0 "log[(1+N Beach missions 1800)/eth_area]"
label var eth_lbeach03_pro_yn_50 "log[(1+N Beach missions 1850)/eth_area]"
label var eth_lbeach03_pro_yn_100"log[(1+N Beach missions 1900)/eth_area]"
label var eth_ncity1400 "N cities in 1400 in ethnic homeland (ethnic)"
label var eth_ncity1800 "N cities in 1800 in ethnic homeland (ethnic)"
label var eth_nslaveports "N slave ports in ethnic homeland (ethnic)"
label var eth_nationalcities "N national cities in ethnic homeland (ethnic)"
label var eth_explorer_contact "Ethnic homeland dissected by European explorer route (ethnic)"
label var eth_railway_contact_dissect97 "Ethnic homeland dissected by 1897 railroad (ethnic)"
label var eth_ln_export_area "Log [(total slave exports: Atlantic + Indian) / area (km^2)] (ethnic)"
label var eth_yrstudy_yn 
label var eth_yrstudy1924 "Ethnic group studied by 1924 (ethnic)"
label var eth_missing_murdock "Ethnic group is missing in Murdock (ethnic)"
label var eth_centra "Ethnic group was centralised (ethnic)"
label var eth_nevercolonised "Proportion of ethnic group's homeland that was never colonised (ethnic)"
label var eth_slavery "Ethnic group had slavery (ethnic)"
label var eth_polygamy "Ethnic group was polygamous (ethnic)"
label var eth_prec_mean "Average precipitation in ethnic homeland (ethnic)"
label var eth_altitude "Average altitude of ethnic homeland (ethnic)"
label var eth_soil5 "Average soil quality (1-5) in ethnic homeland (ethnic)"
label var eth_malaria "Average malaria index of ethnic homeland (ethnic)" 
label var eth_tsetse "Average tsetse index of ethnic homeland (ethnic)"
label var eth_river_nav10km "Proportion of cells within 10 km of a navigable river (ethnic)" 
label var eth_nlakecells "Proportion of cells within 10km of a lake (ethnic)" 
label var eth_rail1924 "Proportion of cells within 10km of a 1924 railroad (ethnic)" 
label var eth_rail1924_25 "Proportion of cells within 25km of a 1924 railroad (ethnic)" 
label var eth_density1800m "Mean population density 1800 within ethnic homeland (ethnic)"
label var eth_date_col_min "Earliest date of colonisation of ethnic group (ethnic)"
label var eth_alt_std "SD altitudes within ethnic homeland (250m raster) (ethnic)" 
label var eth_lndist2coast "Log mean distance to coast (ethnic)"
label var eth_ldist2river "Log mean distance to navigable river (ethnic)"
label var eth_ldist2lake "Log mean distance to lake (ethnic)"
label var eth_lcitypop1900 "Log urban population 1900 of ethnic homeland (our data, ethnic)"
label var eth_lurbc1900 "Log urban population 1900 of ethnic homeland (HYDE, ethnic)"
label var eth_lrurc1900 "Log rural population 1900 of ethnic homeland (HYDE, ethnic)"
label var eth_lcellvalue1924all "Log mean 1924 cell value of ethnic homeland (ethnic)"
label var eth_ldist2muslimcentre "Log mean distance to Muslim centre (ethnic)"
label var eth_ldensity1800m "Log mean population density 1800 within ethnic homeland (ethnic)"

order  gridcell murdock_name n_roome_national n_true `control_ethnicity' `control_village' `eth_ours' `ours24murd2' `ours24murd2_25', after(respno)

save "Appendix Table A12\replicating_nunn_africa_check.dta", replace